<?php

namespace catchAdmin\smstopic\tables;

use catcher\CatchTable;
use catchAdmin\smstopic\tables\forms\Factory;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class SmsTopic extends CatchTable
{
    public function table()
    {
        return $this->getTable('smstopic')
            ->header([
                HeaderItem::label('编号')->prop('id'),
                HeaderItem::label('主题')->prop('title'),

                HeaderItem::label('操作')->width(400)->actions([
                    Actions::update(),
                    Actions::delete(),
                ]),
            ])
            ->withSearch(
                [
                    Search::text("title", "模板标题"),
                    Search::startAt(),
                    Search::endAt(),
                ])
            ->withActions([
                Actions::create(),

            ])
            ->withDialogWidth('50%')
            ->withDefaultQueryParams(['actionList'])
            ->withApiRoute('smstopic/smsTopic')
            ->toTreeTable()
            ->render();

    }

    protected function form()
    {
        // TODO: Implement form() method.
        return Factory::create('smsTopic');
    }

}